<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:o="http://openfaces.org/"
	xmlns:s="http://jboss.com/products/seam/taglib"
	template="/WEB-INF/esquema/permitTemplate.xhtml">


	<ui:define name="mainControls">
		<h:outputText value="Opciones" />
		<h:outputText value="     " />
		<h:panelGroup>
			<o:commandButton value="&lt;&lt; #{messages['txt.back']}" onclick="goBack();"/>
			<o:commandButton rendered="#{operationPermitHelper.spatialAnalysisOK}" value="#{messages['button.next']} &gt;&gt;" onclick="goNext();"/>
		</h:panelGroup>
	</ui:define>

	<ui:define name="title">
		<div align="center">
			<br/>
			<strong>#{messages['operation_permit.start_header']}</strong>
			<rich:separator lineType="solid"/>
			<br/>
		</div>
	</ui:define>
	
	<ui:define name="permitBody">
		<h:form>
			<style type="text/css">
				.introCol1 {
					vertical-align:top;
					width:30%;
				}
				.introCol2 {
					vertical-align:top;
					width:70%;
				}
			</style>
			
			
			<div align="center">
				<table style="text-align:center;margin:auto;" cellspacing="10">
					<tr>
						<th style="text-align: left;">#{messages['permit.spatial_rulegroup_to_apply']}</th>
						<td style="text-align: left;">
							<h:outputText value="#{generalHelper.formatRuleGroupText( operationPermitHelper.permit.ruleGroup )}" />
							
							<ui:remove>
							<h:selectOneMenu value="#{operationPermitHelper.ruleGroup}" converter="#{operationPermitHelper.permitRuleGroupConverter}" style="width: 95%">
								<f:selectItems value="#{operationPermitHelper.permitRuleGroupItemList}"/>
							</h:selectOneMenu>
							</ui:remove>
						</td>
					</tr>
				</table>
				
				<br />
				<h:panelGroup id="spatialAnalysisResPanel">
					<h:panelGroup rendered="#{not operationPermitHelper.spatialAnalysisOK}">
						<h:graphicImage value="/img/wrong-icon.png" />
						<br />
						<h:outputText value="Se encontraron las siguientes restricciones" />
						<br />
						<br />
						<table>
							<tr>
								<td>
									<ul>
										<ui:repeat var="sr" value="#{operationPermitHelper.restrictingRuleList}">
											<li>#{generalHelper.spatialRuleText(sr, true)}</li>
										</ui:repeat>
									</ul>
								</td>
							</tr>
						</table>
					</h:panelGroup>
					<h:panelGroup rendered="#{operationPermitHelper.spatialAnalysisOK}">
						<h:graphicImage value="/img/right-icon.png" />
						<br />
						<h:outputText value="No se encontraron restricciones" />
					</h:panelGroup>
				</h:panelGroup>
				<br />
				<br />
				<br />
				
				<ui:include src="/permits/includes/spatialAnalysisIncl.xhtml"/>
			</div>
			
			<br />
			<a4j:jsFunction
				name="goBack"
				action="#{operationPermitHelper.goBack}">
			</a4j:jsFunction>
			<a4j:jsFunction
				name="goNext"
				action="next">
			</a4j:jsFunction>
		</h:form>
	</ui:define>

</ui:composition>
